package main.test.SparkAPI.Baics.classApi

class PersonUDF (val name:String, val age:Int)

object PersonUDF{
  /**
   * You must provide
      an explicit return
      type for apply.
   * @param p1
   * @param p2
   * @return
   */
  def apply(p1:PersonUDF,p2:PersonUDF):PersonUDF = {
    val name = s"Son of ${p1.name} and ${p2.name}"
    val age = 0
    new PersonUDF(name,age)
  }


  def apply(name: String): PersonUDF = new PersonUDF(name, 0)
}